package sourceagile.server.doclet.java;

import java.io.File;

import sourceagile.server.doclet.java.easyDoclet.EasyDoclet;

import com.sun.javadoc.ClassDoc;
import com.sun.javadoc.RootDoc;

public class GetJavaDocumentation {

	public static RootDoc getRootDoc(File file) {

		EasyDoclet doclet = new EasyDoclet(file, file);

		return doclet.getRootDoc();
	}

	public static ClassDoc getClassDoc(File file) {

		RootDoc rootDoc = getRootDoc(file);

		ClassDoc classDoc = null;

		if (rootDoc != null) {

			ClassDoc[] classes = rootDoc.classes();

			if (classes != null && classes.length > 0) {

				classDoc = classes[0];
			}
		}

		return classDoc;
	}

}
